<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 100px;
            height: 100px;
            border: 1px dashed black;
            /* background: url(./loading.gif) no-repeat ; */
            /* background: no-repeat !important; */
            background-size:  100% 100% !important;
        }
        input[type=file]{
            width: 100px;
            height: 100px;
            opacity: 0;
        }
    </style>
</head>
<body>
    
    <div class="contain">
        <div class="box">
            <input type="file" >
        </div>
    </div>
   <button>+</button>
    <script>
   
       
            document.querySelector("input").onchange = function(){
                const reader = new FileReader()
                reader.readAsDataURL(this.files[0]);
                    reader.onload=(e)=>{
                        document.querySelector('.box').style.cssText =`background:url(${ e.target.result}) `
                    }
                }
            
        
        document.querySelector("button").onclick = function(){
        }
    </script>
</body>
</html>